<?php

// +-----------------------------------------------------------------------
// | @Copyright (c) 2012 http://t00ls.net.
// +-----------------------------------------------------------------------
// | @Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +-----------------------------------------------------------------------
// | @author: lenush <jnicklasj@gmail.com> qq:707207845
// +-----------------------------------------------------------------------

class FormAction extends CommonAction {

    //过滤查询字段
    function _filter(&$map) {
        if (!empty($_POST['name'])) {
            $map['title'] = array('like', "%" . $_POST['name'] . "%");
        }
    }

    public function add() {
        $model = M('category');
        $category = $model->where('status=1')->select();
        $this->assign('category', $category);
        $this->display();
    }

    public function edit() {
        $model = M('category');
        $category = $model->where('status=1')->select();
        $name = $this->getActionName();
        $model = M($name);
        $id = $_REQUEST [$model->getPk()];
        $vo = $model->getById($id);
        $this->assign('vo', $vo);
        $this->assign('category', $category);
        $this->display();
    }

}

/**
* // +---------------------------------------------------------------------
* // | @ Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
* // +---------------------------------------------------------------------
* // | @ author: lenush <jnicklasj@gmail.com> qq:707207845
* // +---------------------------------------------------------------------
* Local variables:
* tab-width:4
* basic-offset:4
* indent-tabs-mode:t
* End:
*/
